//
//  historyListCell.m
//  WHB_driver
//
//  Created by 徐国庆 on 15/12/24.
//  Copyright (c) 2015年 turing. All rights reserved.
//

#import "historyListCell.h"

@implementation historyListCell

- (void)awakeFromNib {
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        //上方空白
        self.topLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.topLabel];
        
        //货单号
        self.shipListNumberLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.shipListNumberLabel];
        
        //货单状态
        self.stateLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.stateLabel];
        self.stateLabel.textAlignment = NSTextAlignmentRight;
        
        // 线1
        self.line1 = [[UILabel alloc] init];
        [self.contentView addSubview:self.line1];
        
        //出发地
        self.setoutAddressLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.setoutAddressLabel];
        
        //地址指向图标
        self.addressImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.addressImageView];
        
        //目的地
        self.aimAddressLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.aimAddressLabel];
        
        //介质图标
        self.mediumImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.mediumImageView];
        
        //介质内容
        self.mediumLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.mediumLabel];
        
        //重量图标
        self.weightImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.weightImageView];
        
        //重量
        self.weightLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.weightLabel];
        
        // 是否签收
        self.signInLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.signInLabel];
        self.signInLabel.textAlignment = 2;
        
        // 线2
        self.line2 = [[UILabel alloc] init];
        [self.contentView addSubview:self.line2];
        
        //备注
        self.remarkLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.remarkLabel];
        
        //备注内容
        self.remarkContentLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.remarkContentLabel];
        self.remarkContentLabel.textAlignment = 2;

    }
    return self;
}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.topLabel.frame = CGRectMake(0, 0, self.frame.size.width, 10);
    self.shipListNumberLabel.frame = CGRectMake(10, 10, 200, 40);
    self.stateLabel.frame = CGRectMake(self.frame.size.width - 100, self.shipListNumberLabel.frame.origin.y, 80, 40);
    self.line1.frame = CGRectMake(0, CGRectGetMaxY(self.stateLabel.frame), self.frame.size.width, 0.5);
    self.setoutAddressLabel.frame = CGRectMake(10, CGRectGetMaxY(self.line1.frame), 50, 40);
    self.addressImageView.frame = CGRectMake(CGRectGetMaxX(self.setoutAddressLabel.frame) - 5, self.setoutAddressLabel.frame.origin.y + 15, 25, 14);
    self.aimAddressLabel.frame = CGRectMake(CGRectGetMaxX(self.addressImageView.frame), self.setoutAddressLabel.frame.origin.y, 50, 40);
    
    self.mediumImageView.frame = CGRectMake(10, CGRectGetMaxY(self.setoutAddressLabel.frame) + 0.5, 16, 16);
    self.mediumLabel.frame = CGRectMake(CGRectGetMaxX(self.mediumImageView.frame) + 3, self.mediumImageView.frame.origin.y - 8, 50, 30);
    self.weightImageView.frame = CGRectMake(CGRectGetMaxX(self.mediumLabel.frame), self.mediumImageView.frame.origin.y, 16, 16);
    self.weightLabel.frame = CGRectMake(CGRectGetMaxX(self.weightImageView.frame) + 3, self.weightImageView.frame.origin.y - 8, 50, 30);
    self.signInLabel.frame = CGRectMake(self.frame.size.width - 100, self.setoutAddressLabel.frame.origin.y, 80, 40);
     self.line2.frame = CGRectMake(0, CGRectGetMaxY(self.mediumLabel.frame), self.frame.size.width, 0.5);
    
    self.remarkLabel.frame = CGRectMake(10, CGRectGetMaxY(self.line2.frame) + 0.5, 70, 40);
    self.remarkContentLabel.frame  = CGRectMake(CGRectGetMaxX(self.remarkLabel.frame) + 20, self.remarkLabel.frame.origin.y, self.frame.size.width - CGRectGetMaxX(self.remarkLabel.frame) - 40, 40);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
